BuffEffect13 = BaseBuffEffect:new();
BuffEffect13.__index = BuffEffect13;

function BuffEffect13:new()
    local object = {};
    setmetatable(object, BuffEffect13);
    return object;
end

function BuffEffect13:action(fight,buff,...)
    local target = select('1',...);
    local skill = select('2',...);
    local skillBean = skill.skill.skillBean;
    local buffValue = decodeJsonStrToTabel(buff.buffBean.f_Value);
    if skillBean.f_IfATK == EnumConst.SkillTypeEnum.NORMAL_ATTACK then
        local random = FightManager.getRandomInt(fight,EnumConst.TEN_THOUSANDTH);
        if random < buffValue[1] then
            fightLog("[EFFECT]Fighter "..buff.target.fighterId.." Buff"..buff.modelId.." 触发普通攻击触发另一次攻击效果");
            local result = FightResult.New();
            FightDamageManager.countDamage(fight,buff.source,target,result,true,EnumConst.SkillDamageTypeEnum.NORMAL,buffValue[2]);
            FightDamageManager.realDamage(fight,buff.source,target,result,EnumConst.SkillDamageTypeEnum.NORMAL);

        end

    end
    return EnumConst.IBuffEffect.SUCCESS;
--[[    if skillBean.f_TriggerFigthHurt == EnumConst.SkillDamageTypeEnum.HEAL then
        return EnumConst.IBuffEffect.SUCCESS;
    end

    local maxHp = FighterAttributeManager.getFightAttr(target,EnumConst.FighterAttributeEnum.HP);
    local per = target.hp/maxHp * EnumConst.TEN_THOUSANDTH;
    local buffValue = decodeJsonStrToTabel(buff.buffBean.f_Value);
    if per <= buffValue[1] then
        fightLog("[EFFECT]Fighter "..buff.target.fighterId.." Buff"..buff.modelId.." 触发生命值低于增伤BUFF效果");
        local damage = Mathf.Floor(result.damage * (EnumConst.TEN_THOUSANDTH + buffValue[2])/EnumConst.TEN_THOUSANDTH);
        fightLog("[DAMAGE]" .. buff.source.fighterId .. "对" .. buff.target.fighterId .. "计算BUFF(" .. buff.modelId .. ")增伤伤害[4]结果" .. subDigitalNum(damage,4));
        result.damage = damage;
    end
    return EnumConst.IBuffEffect.SUCCESS;]]
end